/*

Author   : chaos

FileName : ptr_2d.cpp

Date     : 08/08/17 14:46:38

*/
#include <iostream>
using namespace std;

int main(void)
{
    int array[3][4] = {{0,1,2,3},{4,5,6,7},{8,9,10,11}}, *ptr;

    ptr = array[0];

    cout << "element\t\t\t| &ptr[i]\t|ptr[i]" << endl;
    cout << "-------------------------------------------" << endl;

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 4; j++) {
            cout << "array[" << i << "][" << j << "],ptr[" <<(i*4+j) <<"]\t|" << &ptr[i*4+j] << "\t|"
              << ptr[i*4+j] << endl;
        }
    }

    return 0;
}
